package com.zb.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zb.entity.ZjFactoryRechargeVoucher;
import com.zb.mapper.ZjFactoryRechargeVoucherMapper;
import com.zb.service.ZjFactoryRechargeVoucherService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 厂商充值凭证表 服务实现类
 * </p>
 *
 * @author WEN
 * @since 2024-05-31
 */
@Service
public class ZjFactoryRechargeVoucherServiceImpl extends ServiceImpl<ZjFactoryRechargeVoucherMapper, ZjFactoryRechargeVoucher> implements ZjFactoryRechargeVoucherService {

    // 根据充值ID获取凭证
    @Override
    public List<ZjFactoryRechargeVoucher> getByFactoryRechargeIds(List<Long> factoryRechargeIds) {
        if (CollectionUtil.isEmpty(factoryRechargeIds)) {
            return new ArrayList<>();
        }
        QueryWrapper<ZjFactoryRechargeVoucher> wrapper = new QueryWrapper<>();
        wrapper.select("id", "factory_recharge_id", "image")
                .in("factory_recharge_id", factoryRechargeIds);
        return this.list(wrapper);
    }
}
